Optimal. Leaf size=101 \[ \frac {(-B+i A) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {(A+3 i B) \tan (c+d x)}{2 a d}+\frac {(-B+i A) \log (\cos (c+d x))}{a d}+\frac {x (A+3 i B)}{2 a} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.12, antiderivative size = 101, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {3595, 3525, 3475} \[ \frac {(-B+i A) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {(A+3 i B) \tan (c+d x)}{2 a d}+\frac {(-B+i A) \log (\cos (c+d x))}{a d}+\frac {x (A+3 i B)}{2 a} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3525
Rule 3595
Rubi steps
\begin {align*} \int \frac {\tan ^2(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=\frac {(i A-B) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\int \tan (c+d x) (2 a (i A-B)+a (A+3 i B) \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac {(A+3 i B) x}{2 a}-\frac {(A+3 i B) \tan (c+d x)}{2 a d}+\frac {(i A-B) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {(i A-B) \int \tan (c+d x) \, dx}{a}\\ &=\frac {(A+3 i B) x}{2 a}+\frac {(i A-B) \log (\cos (c+d x))}{a d}-\frac {(A+3 i B) \tan (c+d x)}{2 a d}+\frac {(i A-B) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 4.98, size = 240, normalized size = 2.38 \[ \frac {(\cos (d x)+i \sin (d x)) (A+B \tan (c+d x)) \left ((B-i A) (\cos (c)-i \sin (c)) \cos (2 d x)+2 d x (A+3 i B) (\cos (c)+i \sin (c))+(A+i B) (-\cos (c)+i \sin (c)) \sin (2 d x)+2 i (A+i B) (\cos (c)+i \sin (c)) \log \left (\cos ^2(c+d x)\right )+4 (A+i B) (\cos (c)+i \sin (c)) \tan ^{-1}(\tan (d x))+4 d x (A+i B) \tan (c) (\sin (c)-i \cos (c))-4 A d x \sec (c)-4 i B d x \sec (c)+4 B (\tan (c)-i) \sin (d x) \sec (c+d x)\right )}{4 d (a+i a \tan (c+d x)) (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.74, size = 130, normalized size = 1.29 \[ \frac {2 \, {\left (3 \, A + 5 i \, B\right )} d x e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (2 \, {\left (3 \, A + 5 i \, B\right )} d x - i \, A + 9 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left ({\left (4 i \, A - 4 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (4 i \, A - 4 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i \, A + B}{4 \, {\left (a d e^{\left (4 i \, d x + 4 i \, c\right )} + a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.57, size = 101, normalized size = 1.00 \[ \frac {\frac {{\left (-i \, A - B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a} - \frac {{\left (3 i \, A - 5 \, B\right )} \log \left (-i \, \tan \left (d x + c\right ) - 1\right )}{a} - \frac {4 i \, B \tan \left (d x + c\right )}{a} - \frac {-3 i \, A \tan \left (d x + c\right ) + 5 \, B \tan \left (d x + c\right ) - A - 3 i \, B}{a {\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.17, size = 137, normalized size = 1.36 \[ -\frac {i B \tan \left (d x +c \right )}{d a}-\frac {B \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}-\frac {i A \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}-\frac {A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {i B}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {3 i \ln \left (\tan \left (d x +c \right )-i\right ) A}{4 d a}+\frac {5 \ln \left (\tan \left (d x +c \right )-i\right ) B}{4 d a} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.30, size = 95, normalized size = 0.94 \[ -\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )}{4\,a\,d}-\frac {B\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}{a\,d}-\frac {\left (A+B\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,a\,d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-5\,B+A\,3{}\mathrm {i}\right )}{4\,a\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.64, size = 160, normalized size = 1.58 \[ - \frac {2 B}{- a d e^{2 i c} e^{2 i d x} - a d} + \begin {cases} - \frac {\left (i A - B\right ) e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: 4 a d e^{2 i c} \neq 0 \\x \left (- \frac {3 A + 5 i B}{2 a} + \frac {i \left (- 3 i A e^{2 i c} + i A + 5 B e^{2 i c} - B\right ) e^{- 2 i c}}{2 a}\right ) & \text {otherwise} \end {cases} - \frac {x \left (- 3 A - 5 i B\right )}{2 a} + \frac {i \left (A + i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________